<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Block</title>
</head>

<body>
<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "select distinct name_scheme from tbl_dtls_q1_main where type_scheme='RWSS' and district_id=".$distId;
$queryReport = mysql_query($sqlReport);
?>
<table border="0" width="800" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
	  <font face="Verdana" color="#224568">Comparative analysis of field data for Regional WSS</font></span></td>
	</tr>
	<tr>
	  <td bgcolor="#E9E9E9" height="26"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">Table 11 </font></div></td>
  </tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="800" cellspacing="0" cellpadding="0" height="61" bgcolor="#C5D8EB">
			<tr>
				<td width="108" rowspan="2" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
			  Scheme Name</font></td>
				
				<td height="26" colspan="2" align="center">
				<font face="Verdana" style="font-size: 8.5pt">&nbsp;Population covered</font></td>
				<td colspan="2" align="center">
				  <p align="center">
			  <font style="font-size: 8.5pt" face="Verdana">Water supplied (KLD) </font></td>
				<td colspan="2" align="center">
				  <font style="font-size: 8.5pt" face="Verdana">O&amp;M cost (In Rs. Lakh) </font></td>
				<td colspan="2" align="center">
			  <p align="center"><font style="font-size: 8.5pt" face="Verdana">Per capita water supply (lpcd) </font></td>
			    <td colspan="2" align="center"><font style="font-size: 8.5pt" face="Verdana">O&amp;M cost /KL</font></td>
			    <td colspan="2" align="center"><font style="font-size: 8.5pt" face="Verdana">O&amp;M cost /person/annum</font> </td>
			</tr>
			<tr>
			  <td width="40" height="29" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="50" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		      <td width="54" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="48" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		      <td width="67" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="62" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		      <td width="65" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="53" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		      <td width="52" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="55" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		      <td width="53" align="center"><font style="font-size: 8.5pt" face="Verdana">PHED</font></td>
		      <td width="65" align="center"><font style="font-size: 8.5pt" face="Verdana">Field</font></td>
		  </tr>
		
	
		
			<?php
			while($rowReport = mysql_fetch_array($queryReport)) {
			
			$Total1=0;
			$Total2=0;
			$Total3=0;
			//$Total4=0;
			//$Total5=0;
			
		?>
			
			<tr bgcolor="#FFFFFF">
				<td width="108" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['name_scheme']; ?></font></td>
				
				<?php 
				$sqlReportScheme="SELECT sum(main.`present_population`) population,sum(last.water_supply) water,sum(`mpc_9_10`)+sum(`mc_mr_9_10`)+sum(`mc_pr_9_10`)+sum(`pc_9_10`)+sum(`cc_9_10`) FY FROM `tbl_dtls_q1_main` main,tbl_dtls_q1_last last where main.`district_id` = ".$distId." and main.`name_scheme`='".$rowReport['name_scheme']."' and last.loc_id=main.id";
				//echo $sqlReportScheme;
				$queryReportScheme = mysql_query($sqlReportScheme);
				while($rowReportScheme = mysql_fetch_array($queryReportScheme)) {
				
				//$Total1=0;
				$Total1+=$rowReportScheme['population']; 
				$Total2+=$rowReportScheme['water'];
				$Total3+=number_format($rowReportScheme['FY'],2,'.','');
				
				//$Total4+=$x;
				//$Total5+=$y;
				?>
				<td width="42" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReportScheme['population']; ?></font></td>
				<td width="48" align="center">&nbsp;</td>
				<td width="54" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format($rowReportScheme['water'],2,'.',''); ?></font></td>
				<td width="48" align="center">&nbsp;</td>
				<td width="67" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format($rowReportScheme['FY'],2,'.',''); ?></td>
				<td width="65" align="center">&nbsp;</td>
				<td width="64" align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($rowReportScheme['population']==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($rowReportScheme['water']*1000/$rowReportScheme['population'],2,'.','');} ?>
				</font></td>
			    <td width="53" align="center">&nbsp;</td>
			    <td width="52" align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($rowReportScheme['water']==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($rowReportScheme['FY']*100000/365/$rowReportScheme['water'],2,'.','');} ?>
				</font></td>
			    <td width="53" align="center">&nbsp;</td>
			    <td width="53" align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($rowReportScheme['population']==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($rowReportScheme['FY']*100000/$rowReportScheme['population'],2,'.','');} ?>
				</font></td>
			    <td width="65" align="center">&nbsp;</td>
			</tr>
			<?php
			}
			$tot1+=$Total1;
			$tot2+=$Total2;
			$tot3+=$Total3;
			}
			 
			?>
			<tr bgcolor="#E9E9E9">
				<td align="center"><font face="Verdana" style="font-size: 8.5pt">Total</font></td>
				
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $tot1; ?></font></td>
				<td align="center">&nbsp;</td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format($tot2,2,'.',''); ?></font></td>
				<td align="center">&nbsp;</td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format($tot3,2,'.',''); ?></font></td>
				<td align="center">&nbsp;</td>
				<td align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($tot1==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($tot2*1000/$tot1,2,'.','');} ?>
				</font></td>
			    <td align="center">&nbsp;</td>
			    <td align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($tot2==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($tot3*100000/365/$tot2,2,'.','');} ?>
				</font></td>
			    <td align="center">&nbsp;</td>
			    <td align="center"><font face="Verdana" style="font-size: 8.5pt">
				  <?php
				if($tot1==0)
				{
				echo $x="0.00";
				}else{
				echo $x=number_format($tot3*100000/$tot1,2,'.','');} ?>
				</font></td>
			    <td align="center">&nbsp;</td>
			</tr>
		</table>		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


</body>

</html>